fs_extra
A Rust library that provides additional functionality not present in std::fs
.
Key features:
-
Copy files (optionally with information about the progress).
-
Copy directories recursively (optionally with information about the progress).
-
Move files (optionally with information about the progress).
-
Move directories recursively (optionally with information about the progress).
-
A single method for create and write
String
content in file. -
A single method for open and read
String
content from file. -
Get folder size
-
Get collection of directory entries
Functions:
Function | Description |
---|---|
fs_extra::copy_items | Recursively copies files and directories from one location to another |
fs_extra::copy_items_with_progress | Recursively copies files and directories from one location to another with information about progress |
fs_extra::move_items | Recursively moves files and directories from one location to another |
fs_extra::move_items_with_progress | Recursively moves files and directories from one location to another with information about progress |
fs_extra::remove_items | Removes files or directories |
fs_extra::file::copy | Copies the contents of one file to another |
fs_extra::file::copy_with_progress | Copies the contents of one file to another with information about progress |
fs_extra::file::move_file | Moves a file from one location to another |
fs_extra::file::move_file_with_progress | Moves a file from one location to another with information about progress |
fs_extra::file::remove | Removes a file |
fs_extra::file::read_to_string | Reads file content into a String |
fs_extra::file::write_all | Writes String content to a file |
fs_extra::dir::create | Creates a new, empty directory at the given path |
fs_extra::dir::create_all | Recursively creates a directory and all of its parent components if they are missing |
fs_extra::dir::copy | Recursively copies the directory contents from one location to another |
fs_extra::dir::copy_with_progress | Recursively copies the directory contents from one location to another with information about progress |
fs_extra::dir::move_dir | Moves directory contents from one location to another |
fs_extra::dir::move_dir_with_progress | Moves directory contents from one location to another with information about progress |
fs_extra::dir::remove | Removes directory |
fs_extra::dir::get_size | Returns the size of the file or directory |
fs_extra::dir::get_dir_content | Gets details such as the size and child items of a directory |
fs_extra::dir::get_dir_content2 | Gets details such as the size and child items of a directory using specified settings |
fs_extra::dir::get_details_entry | Gets attributes of a directory entry |
fs_extra::dir::ls | Gets attributes of directory entries in a directory |
Usage
Add this to your Cargo.toml
:
[]
= "1.3.0"
Examples
The following example shows how to copy a directory recursively and display progress. First a source directory ./temp/dir
containing file test1.txt
and a subdirectory sub
is createad with sub
itself having a file test2.txt
. ./temp/dir
and all contents are then copied out to ./out/dir
.
use Path;
use ;
use ;
extern crate fs_extra;
use *;
use *;